﻿using DAL;
using IService;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Service
{
    public class BiWarehouseService : IBiWarehouseService
    {
        private BiWarehouseDal dal;
        public BiWarehouseService(BiWarehouseDal dal)
        {
            this.dal = dal;
        }

        public Task<int> CreateAsync(BiWarehouse data)
        {
            return dal.CreateAsync(data);
        }

        public Task<int> DeleteAsync(int Id)
        {
            return dal.DeleteAsync(Id);
        }

        public Task<List<BiWarehouse>> GetAllAsync()
        {
            return dal.GetAllAsync();
        }

        public Task<BiWarehouse> GetByIdAsync(int Id)
        {
            return dal.GetByIdAsync(Id);
        }

        public Task<List<dynamic>> GetLocationWithUserAsync()
        {
            return dal.GetLocationWithUserAsync();
        }

        public Task<List<dynamic>> GetUniqueLocationManagersAsync()
        {
            return dal.GetUniqueLocationManagersAsync();
        }

        public Task<int> UpdateAsync(BiWarehouse date)
        {
            return dal.UpdateAsync(date);
        }

        /// <summary>
        /// 新增库位
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public Task<int> LocationAddAsync(WhLocation data)
        {
            return dal.LocationAddAsync(data);
        }
        public async Task<int> SaveWithTransactionAsync(BiWarehouse warehouse, List<WhLocation> locations)
        {
            return await dal.SaveWithTransactionAsync(warehouse, locations);
        }
        public async Task<List<UsersDTO>> GetWarehouseManagersAsync(long warehouseManageOrgId)
        {
            return await dal.GetWarehouseManagersAsync(warehouseManageOrgId);
        }
    }
}
